import threading
import logging
#logger=logging.getLogger(__name__)
#import config
#logger=Logger(__name__).getLogger()
class Thread(threading.Thread):
    #def __init__(self,func=None,logger=None,taskID=None,*args):
    def __init__(self,*args,**kwargs):
        self.func=kwargs['func']
        self.args=args
        self.__id=kwargs['taskID']
        self.__logger=kwargs['logger']
        threading.Thread.__init__(self)
        #threading.Thread.setName(self,threading.Thread.getName(self)+'-'+taskID)
        self.setName(self.getName()+'-'+self.__id)
    def run(self):
        self.__logger.info("threadnum:"+str(threading.activeCount()))
        self.__logger.info("start")
        #print("thread:"+self.getName(),"threadnum:"+str(threading.activeCount()))
        if self.args:
            self.func(self.args)
        else:
            self.func()
        self.__logger.info("end")
        #print("thread:"+self.getName(),"end")
   ## def activeCount(self):
   #     return threading.activeCount()
   # def threadlist(self):
   #     return threading.enumerate()

if __name__ == '__main__':
    pass
